/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package it.unibo.as.HeartsLogic;
//
//import java.util.ArrayList;
//
///**
// *
// * @author lilith
// */
//class TurnGame 
//{
//    private int currentPlayer;
//    
//    private String tableSeed;
//    private boolean firstTurn;
//    private boolean playHearts;
//    
//    private Card PlayedCard[];
//    private int RemainCard[];
//    private int stateTurn;
//    private int winPlayer;
//    
//    private static final int STEP_FIRST = 0;
//    private static final int STEP_SECOND = 1;
//    private static final int STEP_THIRD = 2;
//    private static final int STEP_FOURTH = 3;
//    private static final int STEP_EVALUATE = 4;
//    
//    DeckCard dc;
//    
//    
//    
//    TurnGame(ArrayList<Player> PlayerArray) 
//    {
//        dc = new DeckCard();
//        dc.getPlayerCard(PlayerArray);
//        boolean bContinue = true;
//        Card c = new Card(SeedCard.SPADES, 0);
//        currentPlayer = -1;
//        
//        for(int i = 0; (i < PlayerArray.size()) && bContinue; i++)
//        {
//            ArrayList<Card> cardList = PlayerArray.get(i).getCards();
//            for(int j = 0; (j < cardList.size()) && bContinue; j++)
//            {
//                bContinue = !(cardList.get(j).compare(c));
//                if(!bContinue)
//                {
//                    currentPlayer = i;
//                }
//            }
//        }
//        
//        if(currentPlayer == -1)
//        {
//            currentPlayer = 0;
//        }
//        
//        tableSeed = SeedCard.NULL;
//        firstTurn = true;
//        playHearts = false;
//        
//        stateTurn = STEP_FIRST;
//        winPlayer = -1;
//        PlayedCard = new Card[Common.PLAYER_NUM];
//        RemainCard = new int[Common.PLAYER_NUM];
//        
//        for(int i=0; i<Common.PLAYER_NUM; i++)
//        {
//            RemainCard[i] = Common.CARD_NUM;
//            PlayedCard[i] = null;
//        }
//    }
//
//    TurnGame(TurnGame currentTurn) 
//    {
//        tableSeed = currentTurn.tableSeed;
//        firstTurn = currentTurn.firstTurn;
//        playHearts = currentTurn.playHearts;
//                
//        currentPlayer = currentTurn.currentPlayer;
//        winPlayer = currentTurn.winPlayer;
//        stateTurn = currentTurn.stateTurn;
//        
//        for(int i=0; i<Common.PLAYER_NUM; i++)
//        {
//            RemainCard[i] = currentTurn.RemainCard[i];
//            PlayedCard[i] = currentTurn.PlayedCard[i];
//        }
//    }
//    
//    int nextTurn()
//    {
//        stateTurn++;
//        currentPlayer = (currentPlayer + 1)%Common.PLAYER_NUM;
//        firstTurn = false;
//        
//        if(stateTurn == STEP_EVALUATE)
//        {
//            boolean bContinue = true;
//            int maxCard = -1;
//            for(int i = 0; (i < Common.PLAYER_NUM) && bContinue; i++)
//            {
//                if(PlayedCard[i].seedCard == tableSeed)
//                {
//                    if(PlayedCard[i].numberCard != Common.CARD_A)
//                    {
//                        if(maxCard < PlayedCard[i].numberCard)
//                        {
//                            maxCard = PlayedCard[i].numberCard;
//                            currentPlayer = i;
//                            winPlayer = i;
//                        }
//                    }
//                    else
//                    {
//                        currentPlayer = i;
//                        winPlayer = i;
//                        bContinue = false;
//                    }
//                }
//            }
//        }
//        return stateTurn;
//    }
//    
//    
//    boolean playCard(Card card, Player player)
//    {
//        boolean bRet = false;  
//        
//        if(player.playCard(tableSeed, firstTurn, playHearts, card))
//        {
//            PlayedCard[currentPlayer] = card;
//            RemainCard[currentPlayer] = player.getCards().size();
//            
//            if(card.seedCard == SeedCard.HEARTS)
//            {
//                playHearts = true;
//            }
//            
//            bRet = true;
//        }
//        
//        return bRet;
//    }   
//}
//